﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using TomShane.Neoforce.Controls;

namespace Madrigal
{
    public enum MessageBoxButtons
    {
        ARI, // About, Retry, Ignore
        OK, // OK
        OC, // OK, Cancel
        RC, // Retry, Cancel
        YN, // Yes, No
        YNC, // Yes, No, Cancel
        Cancel, // Cancel
    }

    class WndMessageBox : GameScreen
    {
        Manager manager;
        Window messageBox;
        TextBox tbMessage;
        Button btnAbort, btnRetry, btnIgnore, btnOK,
            btnCancel, btnYes, btnNo;
        

        public WndMessageBox(Manager manager, string message, MessageBoxButtons buttonType)
        {
            this.manager = manager;
            IsPopup = true;

            messageBox = new Window(this.manager);
            messageBox.Init();
            messageBox.Resizable = false;
            messageBox.Width = 256;
            messageBox.Height = 256;
            //messageBox.Closing +=new WindowClosingEventHandler(messageBox_Closing);

            tbMessage = new TextBox(this.manager);
            tbMessage.Init();
            tbMessage.Mode = TextBoxMode.Multiline;
            tbMessage.ReadOnly = true;
            tbMessage.SetPosition(messageBox.ClientArea.Left + 10, messageBox.ClientArea.Top + 5);
            tbMessage.SetSize(messageBox.Width - 10, 96);
            tbMessage.Text = message;

            List<Button> buttonsToShow = new List<Button>();
            buttonsToShow.Clear();
            switch (buttonType)
            {
                case MessageBoxButtons.ARI:
                    {
                        //CreateButton("Abort");
                        //CreateButton("Retry");
                        //CreateButton("Ignore");
                    }
                    break;
                case MessageBoxButtons.OK:
                    {
                        btnOK = new Button(this.manager);
                    }
                    break;
                case MessageBoxButtons.Cancel:
                    {
                        btnCancel = new Button(this.manager);
                    }
                    break;
                case MessageBoxButtons.OC:
                    {
                        btnOK = new Button(this.manager);
                        btnCancel = new Button(this.manager);
                    }
                    break;
                case MessageBoxButtons.RC:
                    {
                        btnRetry = new Button(this.manager);
                        btnCancel = new Button(this.manager);
                    }
                    break;
                case MessageBoxButtons.YN:
                    {
                        btnYes = new Button(this.manager);
                        btnNo = new Button(this.manager);
                    }
                    break;
                case MessageBoxButtons.YNC:
                    {
                        btnYes = new Button(this.manager);
                        btnNo = new Button(this.manager);
                        btnCancel = new Button(this.manager);
                    }
                    break;
            }
        }
    }
}
